package 操作系统实验.实验二.生产者与消费者;


/**
 *创建生产者
 */
public class CreateProducer implements Runnable{
    ProductiveConsumption pc;
    int producerNum;
    public CreateProducer(ProductiveConsumption pc,int producerNum){
        this.pc=pc;
        this.producerNum=producerNum;
    }
    public void run(){
        for(int i=0;i<producerNum;i++){
            Producer producer=new Producer(pc);
            try {
                Thread.sleep((int)(Math.random()*100));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}